package com.app.notificationmodule.service

import android.app.Service
import android.content.Intent
import android.os.IBinder
import android.util.Log
import androidx.core.app.RemoteInput



class NotificationService : Service() {

    private val TAG = NotificationService::class.java.simpleName

    override fun onBind(intent: Intent?): IBinder? {
        return null
    }


    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {

        // 获取RemoteInput中的Result
        val resultsFromIntent = RemoteInput.getResultsFromIntent(intent)
        //根据key拿回复的内容
        if (null != resultsFromIntent) {
            val resultString = resultsFromIntent!!.getString("key_text_reply")
            Log.d(TAG, "NotificationService --> resultString -> $resultString")
        }

        return super.onStartCommand(intent, flags, startId)
    }

}